package com.java.controller.api;


import com.java.pojo.entity.LendItemReturn;
import com.java.pojo.entity.LendReturn;
import com.java.result.Result;
import com.java.service.LendItemReturnService;
import com.java.service.LendReturnService;
import com.java.utils.JwtUtils;
import io.jsonwebtoken.Jws;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 还款记录表 前端控制器
 * </p>
 *
 * @author Helen
 * @since 2021-07-08
 */
@RestController
@RequestMapping("/api/core/lendItemReturn")
public class LendItemReturnController {

    @Resource
    private LendItemReturnService lendItemReturnService;

    @GetMapping("/list/{lendId}")
    private Result list(@PathVariable Long lendId, HttpServletRequest request){
        String token = request.getHeader("token");
        Long investUserId = JwtUtils.getUserId(token);
        List<LendItemReturn> list = lendItemReturnService.selectByLendId(lendId,investUserId);
        return Result.ok(list);
    }
}

